﻿
////////////////////////////////////////////////////////////////////////////////////////////
// 文件名: SSConfigBLL.gen.cs
//
// 模块名称: SSConfigBll
//
// 作者: LPC
//
// 历史记录（记录修改记录，修改文件后请添加修改记录，注明修改时间、修改人，修改内容）:
// 13-1-22    LPC    创建文件
////////////////////////////////////////////////////////////////////////////////////////////

using System;
using System.Data.SqlClient;
using Common;
using DAL;
using Model;
using System.Data;
using System.Collections.Generic;

namespace BLL
{
    /// <summary>
    /// SSConfig表业务逻辑层
    /// </summary>
    public partial class SSConfigBLL: BaseBLL
    {
        public SSConfigBLL(LoginInfo info)
        {
            loginInfo = info;
        }
        const string RightCodeInsert = "";    //添加权限编码
        const string RightCodeUpdate = "";    //修改权限编码
        const string RightCodeDelete = "";    //删除权限编码
        
        const string ErrorCodeSelect = "";    //查询异常编码
        const string ErrorCodeInsert = "";    //添加异常编码
        const string ErrorCodeUpdate = "";    //修改异常编码
        const string ErrorCodeDelete = "";    //删除异常编码
         
        /// <summary>
        /// 根据GUID字段获取SSConfigInfo实体对象
        /// </summary>
        /// <param name="guid">GUID</param>
        /// <returns>SSConfigInfo实体对象</returns>
        public SSConfigInfo GetInfoById (string guid)
        {
            try
            {
                return new SSConfigDAL(loginInfo).GetInfoById(guid);
            }
            catch(Exception ex)
            {
                Logger.LogError("SSConfigBLL", "GetInfo", AppError.EROR, 0, ex, "获取SSConfigBll信息出错。",
                                String.Format("guid = {0}", guid));
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }
        public List<SSConfigInfo> GetInfoList(IDataParameter[] par)
        {
            try
            {
                return new SSConfigDAL(loginInfo).GetInfoList(par);
            }
            catch (Exception ex)
            {
                Logger.LogError("SSConfigBLL", "GetInfo", AppError.EROR, 0, ex, "获取SSConfigBll信息出错。",
                                "");
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }

        /// <summary>
        /// 往SSConfig表内添加新记录
        /// </summary>
        /// <param name="sSConfigInfo">SSConfigInfo实体对象</param>
        /// <returns>添加记录索引值</returns>
        public int Insert(IDataParameter[] sSConfigInfo)
        {
            try
            {
                int identity = new SSConfigDAL(loginInfo).Insert(sSConfigInfo);
                return identity;
            }
            catch(Exception ex)
            {
                Logger.LogError("SSConfigBLL", "Insert", AppError.EROR, 0, ex, "添加SSConfigBll信息出错。", null);
                throw new SystemException(ErrorCodeInsert, ex);
            }
        }

        /// <summary>
        /// 更新SSConfig表记录
        /// </summary>
        public void Update(SSConfigInfo sSConfigInfo)
        {
            try
            {
                new SSConfigDAL(loginInfo).Update(sSConfigInfo);
            }
            catch(Exception ex)
            {
                Logger.LogError("SSConfigBLL", "Update", AppError.EROR, 0, ex, "更新SSConfigBll信息出错。", 
                                String.Format("GUID = {0}", sSConfigInfo.Guid));
                throw new SystemException(ErrorCodeUpdate, ex);
            }
        }
        
        /// <summary>
        /// 根据GUID字段获取SSConfigInfo实体对象
        /// </summary>
        /// <param name="guid">GUID</param>
        public void Delete(string guid)
        {
            try
            {
                new SSConfigDAL(loginInfo).Delete(guid);
            }
            catch(Exception ex)
            {
                Logger.LogError("SSConfigBLL", "Delete", AppError.EROR, 0, ex, "删除SSConfigBll信息出错。", 
                                String.Format("guid = {0}", guid));
                throw new SystemException(ErrorCodeDelete, ex);
            }
        }
      }
}